package com.ztr.designpatterns.singleton;

public class Singleton {

    /**这种单例模式示例有问题存在，下文中会做完善，欢迎思考*/
    //静态私有成员变量
    private static Singleton instance = null;

    //私有构造函数
    private Singleton(){
    }

    //静态共有工厂方法，返回唯一实例
    public static Singleton getInstance() {
        if (instance == null)
            instance = new Singleton();
        return instance;
    }

}
